# 指定CMake的最小版本要求   
cmake_minimum_required(VERSION 3.0.0)   

# 定义项目名称和版本号   
project(Rainbow-Log VERSION 1.0.0)    

# 构建libRainbow-Log动态库 
add_library(libRainbow-Log SHARED src/rainbowlog.cpp src/rainbowlog.hpp)

# 定义libRainbow-Log导出宏 
add_definitions(-DBUILD_DLL)

# 构建Rainbow-Log可执行文件 
add_executable(Rainbow-Log src/main.cpp)   

# 让Rainbow-Log可执行文件链接libRainbow-Log库
target_link_libraries(Rainbow-Log libRainbow-Log)   

# 设置CPACK_PROJECT_NAME和CPACK_PROJECT_VERSION variables  
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})    

# 包含CPack以生成安装包     
include(CPack)

# 安装目标
install(TARGETS Rainbow-Log libRainbow-Log DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/bin")
